package com.zyg.page.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;



import java.time.LocalDateTime;


@Data
@AllArgsConstructor
@NoArgsConstructor
//@TableName("student")
public class Student {
    @TableId(type=IdType.AUTO)              //自动增长主键
    private Integer sid;
    private String sname;
    private String sex;
    private Integer age;
    private String addr;
    private Integer cid;
    //自动填充
    @TableField(fill = FieldFill.INSERT,value="createTime")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE,value="updateTime")
    private LocalDateTime updateTime;
    //逻辑删除
    @TableLogic                             //默认1为删除。0代表不删除
    private Integer deleted;

    @TableField(exist = false)              //数据表不存在此字段
    private String cname;

    public Student(String sname, String sex, Integer age, String addr, Integer cid) {
        this.sname = sname;
        this.sex = sex;
        this.age = age;
        this.addr = addr;
        this.cid = cid;
    }
}
